#include <stdio.h>

#include <stdlib.h>


int main()
{
    int sum  = 0;
    int n = 0;
    
    while(1)
    {
         int i = 1;
         sum = 0;
         printf("请输入n值：\n");
         if(!scanf("%d", &n))
         {
             break;
         }
#if 0
        for(i=1; i<=n; i++)
        {
            sum += i;
        }
#endif
        if(n%2)
        {
            sum = n * (n/2);
            sum += n;
        }
        else
        {
             sum = (1+n) * (n/2);
        }

        printf("sum=%d\n",sum);
    }

}
